/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package formularios.model;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Ramon
 */
@Entity
@Table(name = "CLIENTES")
@NamedQueries({
    @NamedQuery(name = "Clientes.findAll", query = "SELECT c FROM Clientes c"),
    @NamedQuery(name = "Clientes.findByCpf", query = "SELECT c FROM Clientes c WHERE c.cpf = :cpf"),
    @NamedQuery(name = "Clientes.findByNome", query = "SELECT c FROM Clientes c WHERE c.nome = :nome"),
    @NamedQuery(name = "Clientes.findByDtns", query = "SELECT c FROM Clientes c WHERE c.dtns = :dtns"),
    @NamedQuery(name = "Clientes.findBySexo", query = "SELECT c FROM Clientes c WHERE c.sexo = :sexo"),
    @NamedQuery(name = "Clientes.findByTelefone", query = "SELECT c FROM Clientes c WHERE c.telefone = :telefone"),
    @NamedQuery(name = "Clientes.findByEndereco", query = "SELECT c FROM Clientes c WHERE c.endereco = :endereco"),
    @NamedQuery(name = "Clientes.findByEmail", query = "SELECT c FROM Clientes c WHERE c.email = :email"),
    @NamedQuery(name = "Clientes.findByRendaIndividual", query = "SELECT c FROM Clientes c WHERE c.rendaIndividual = :rendaIndividual"),
    @NamedQuery(name = "Clientes.findByRendaFamiliar", query = "SELECT c FROM Clientes c WHERE c.rendaFamiliar = :rendaFamiliar")})
public class Clientes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CPF")
    private String cpf;
    @Basic(optional = false)
    @Column(name = "NOME")
    private String nome;
    @Basic(optional = false)
    @Column(name = "DTNS")
    @Temporal(TemporalType.DATE)
    private Date dtns;
    @Basic(optional = false)
    @Column(name = "SEXO")
    private char sexo;
    @Column(name = "TELEFONE")
    private String telefone;
    @Column(name = "ENDERECO")
    private String endereco;
    @Column(name = "EMAIL")
    private String email;
    @Column(name = "RENDA_INDIVIDUAL")
    private Double rendaIndividual;
    @Column(name = "RENDA_FAMILIAR")
    private Double rendaFamiliar;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "clientes")
    private Collection<Vendas> vendasCollection;

    public Clientes() {
    }

    public Clientes(String cpf) {
        this.cpf = cpf;
    }

     public Clientes(String cpf, String nome, Date dtns, char sexo, String telefone, String endereco,
                    String email, Double renda_individual, Double renda_familiar) {
        this.cpf = cpf;
        this.nome = nome;
        this.dtns = dtns;
        this.sexo = sexo;
        this.telefone = telefone;
        this.endereco = endereco;
        this.email = email;
        this.rendaIndividual = renda_individual;
        this.rendaFamiliar = renda_familiar;
    }

    public String getCpf() {
        return cpf;
    }

    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public Date getDtns() {
        return dtns;
    }

    public void setDtns(Date dtns) {
        this.dtns = dtns;
    }

    public char getSexo() {
        return sexo;
    }

    public void setSexo(char sexo) {
        this.sexo = sexo;
    }

    public String getTelefone() {
        return telefone;
    }

    public void setTelefone(String telefone) {
        this.telefone = telefone;
    }

    public String getEndereco() {
        return endereco;
    }

    public void setEndereco(String endereco) {
        this.endereco = endereco;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Double getRendaIndividual() {
        return rendaIndividual;
    }

    public void setRendaIndividual(Double rendaIndividual) {
        this.rendaIndividual = rendaIndividual;
    }

    public Double getRendaFamiliar() {
        return rendaFamiliar;
    }

    public void setRendaFamiliar(Double rendaFamiliar) {
        this.rendaFamiliar = rendaFamiliar;
    }

    public Collection<Vendas> getVendasCollection() {
        return vendasCollection;
    }

    public void setVendasCollection(Collection<Vendas> vendasCollection) {
        this.vendasCollection = vendasCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cpf != null ? cpf.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Clientes)) {
            return false;
        }
        Clientes other = (Clientes) object;
        if ((this.cpf == null && other.cpf != null) || (this.cpf != null && !this.cpf.equals(other.cpf))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "formularios.model.Clientes[cpf=" + cpf + "]";
    }

}
